package beast.evolution.alignment;

import java.util.ArrayList;
import java.util.List;

import beast.core.Description;
import beast.evolution.datatype.Nucleotide;

/**
 * @author Denise Kuehnert
 * 
 *         maths: Tanja Stadler
 */

@Description("extand Alignment to allow return of sequence value")
public class Alignment2 extends Alignment {
	protected List<Sequence> all_sequences = new ArrayList<Sequence>();

	public Alignment2() {
		System.out.println("I'm in the empty constructor!");
	}

	public Alignment2(List<Sequence> sequences, Integer stateCount,
			String dataType) throws Exception {

		for (Sequence sequence : sequences) {
			m_pSequences.setValue(sequence, this);
		}
		all_sequences = sequences;
		// System.out.println("The size of the sequence set is:" +
		// all_sequences.size());
		// m_nStateCount.setValue(stateCount, this);
		m_sDataType.setValue(dataType, this);
		initAndValidate();
	}

	
	// getters
	
	// get all sequences and return them as a list
	public List<Sequence> getSequences() {
		return all_sequences;
	}
	
	// get the sequence with a specific ID and return it in List<Integer> format
	public List<Integer> getSequenceByID(String sequenceID) throws Exception {
		Nucleotide nucleo = new Nucleotide();
		List<Integer> sequenceTarget = new ArrayList<Integer>();
		for (Sequence sequence : all_sequences) {
			if (sequence.m_sTaxon.get().toString() == sequenceID) {
				sequenceTarget = sequence.getSequence(nucleo); 
			}
		}
		return sequenceTarget;
	}
}